public class Demo15 {
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(() -> {
            System.out.println("t1 正在运行");
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("t1 运行结束");
        });
        Thread t2 = new Thread(() -> {
            System.out.println("t2 正在等待 t1");
            try {
                t1.join(2000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("t2 运行结束");
        });
        t1.start();
        t2.start();
        Thread.sleep(1000);
        System.out.println(t2.getState());
    }
}
